Click here to return to the VHDL Reference Guide. (last edit: 24. september 2012)

Integer

An integer type represents a mathematical integer. The maximum values for the range are at least +/- (231 - 1).

Syntax

  type NewName is range Range;
    

Where

See Declaration

Rules

The lower and upper bounds of the Range must be static integer expressions.

Things to remember

Integer types are not mutually compatible; they cannot be mixed unless explicit Type Conversions are used. An unconstrained INTEGER synthesizes to 32 bits, so always give a constraint for synthesis!

Synthesis

An integer range 0 to N-1 synthesizes to a bus of width log N bits. The value 2 is represented as a binary number. Negative numbers are represented in two's complement format.

Tips

It is more convenient to create a subtype of the predefined type INTEGER (e.g. subtype T is INTEGER range 0 to 7;) rather than defining a new integer type.

Example

  type INT is range -8 to 7;
    

See Also

Number, Type, Subtype, Range, Floating, Standard